#! /usr/bin/python
# -*- coding: utf-8 -*-

import os
from google.appengine.ext.webapp import template
import cgi
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext import db

import conf
import paper
import utils
import papernavbar
import xnuser

class MainPage(webapp.RequestHandler):
    def get(self):
        errMsg = ''
        paperList = []
        paperNavbar = papernavbar.getPaperNavbar(self.request)
        nav = ''        
        template_values = {
            'staticUrl': conf.staticUrl,
            'jsVersion': conf.jsVersion,
            'cssVersion': conf.cssVersion,
            'api_key':conf.api_key,
            'nav_bar_title': '最新文章列表',
            'navRssLink': '订阅本站文章',
            'paperCategoryList': conf.paperCategoryList,
            'sysPaperUrlCelebrating': conf.sysPaperUrlCelebrating,
            'sysPaperUrlFaq': conf.sysPaperUrlFaq,
            'sysPaperUrlSiteEvents': conf.sysPaperUrlSiteEvents,
            'sysPaperUrlHowToRss': conf.sysPaperUrlHowToRss,
            'paperList': paperList,
            'paperNavbar': paperNavbar,
            'nav_selected': nav
        }
        path = os.path.join(os.path.dirname(__file__), 'pages/maintain.html')
        self.response.out.write(template.render(path, template_values))


application = webapp.WSGIApplication(
                                     [('/.*', MainPage)],
                                     debug=True)
def main():
    run_wsgi_app(application)

if __name__ == "__main__":
    main()

